package com.ideal.frame.sys.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ideal.frame.entity.AutoModel;
import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
 * @Author: jin
 * @CreateTime: 2019-11-04 10:26
 * @Description: 用户角色关系
 */
@Data
@Entity
@Table(name = "t_sys_user_role")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class SysUserRole extends AutoModel {
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    private SysUser sysUser;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "role_id")
    @NotFound(action= NotFoundAction.IGNORE)
    private SysRole sysRole;
}
